<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />

		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/search.js"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.fm.csv.value="download";
					document.fm.submit();
				}
			});
			$('#btn-reset').click(function(){	
				location.href = document.fm.action;
			});
			$('#btn_search').click(function(){
					document.fm.csv.value="";
					document.fm.submit();
			});
			$('#year4').change(function(){
				var year4 = this.value;
				var myDate = new Date();
				var nowtime =  myDate.getTime();
					
				$.get("mmap_week_ajax.php",{ y: year4,t : nowtime }, function(data){
					$("#week_cd").children().remove();
					$("#week_cd").append( data ); 
				});
			});
			
		});
		function toPage(thepage) {
			document.fm.page.value =  thepage;
			document.fm.csv.value="";
			document.fm.submit();
		}
		function setSS( valcd, valnm ) {
			if (gPara == "shop") {
				document.fm.shop_cd.value = valcd;
				document.fm.shop_name.value = valnm;			
			}
			if (gPara == "mediaid") {
				document.fm.media_cd.value = valcd;
				document.fm.media_name.value = valnm;			
			} 
			$('#dialog').dialog("close");
		}
		</script>
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />
		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
	</head>
	<body id="">
{{$menu}}
{{$logout}}
		<div id="container"><div class="wrapper">
			<h2>マップグループマスター管理</h2>
			<ul class="submenu clearfix">
				<li>マップグループ情報一覧</li>
				{{if $aokimenu[7].li.mmapshop_index.auth }} <li><a href="mmapshop_index.php">マップグループ情報更新</a></li>{{ /if }}
				{{if !$isG7 }} <li><a href="mmapshop_import.php">CSV更新</a></li>{{ /if }}
				{{if $aokimenu[7].li.mmservice_index.auth }} <li><a href="mmservice_index.php">サービスマップマスタ</a></li>{{ /if }}
			</ul>
			<h3>マップグループ情報一覧</h3>
			<form name="fm" id="fm" method="get" action="mmapg_index.php" >
				<input type="hidden" name="page" />
				<table class="formTable">
					<tbody>
						<tr>
							<th>※年度</th>
							<td>
{{ html_options id='year4' name='year4' options=$year4 selected=$forms.year4 }} 年{{ $err.year4 }}
							</td>
							<th>週名</th>
							<td>
{{ html_options id='week_cd' name='week_cd' options=$week  selected=$forms.week_cd }}{{ $err.week_cd }}
							</td>
							</tr>
						<tr>
							<th>区分</th>
							<td>
{{ html_options id='sort' name='sort' options=$map_sort selected=$forms.sort }}
							</td>
							<th>マップNO</th>
							<td>
								<input type="text" name="map_no" class="text"  value="{{ $forms.map_no }}" />
							</td>
						</tr>
						<tr>
							<th>店舗</th>
							<td >
								<input type="text" name="shop_name" class="text" value="{{ $forms.shop_name|escape }}" readonly="readonly" />
								<input type="hidden" name="shop_cd"  value="{{ $forms.shop_cd|escape }}" />
								<button type="button" id="shop" class="btn_search" rel="shop"><span>参照</span></button>
								<button type="button" id="shop_c" class = "btn_clear" rel="shop"><span>クリア</span></button>
							</td>
							<th>新聞紙名</th>
							<td>
							{{ html_options id='media_cd' name='media_cd' options=$pattern selected=$forms.media_cd }}{{ $err.media_cd }}
							<!-- 
								<input type="text" name="media_name" class="text" value="{{ $forms.media_name }}" />
								<input type="hidden" name="media_cd"  value="{{ $forms.media_cd|escape }}" />
								<button type="button" id="mediaid" class="btn_search" rel="media"><span>参照</span></button> -->
							</td>
						</tr>
						<tr>
							<th>合同マップ</th>
							<td>
								{{ html_options name='congruent_map' options=$congruent selected=$forms.congruent_map   }}
							</td>
							<th>合同折込</th>
							<td>
								{{ html_options name='congruent_ins' options=$congruent_ins selected=$forms.congruent_ins }}
							</td>
						</tr>
						<tr>
							
							<th>更新日</th>
							<td colspan="3">
								<input type="text" name="upd_f" class="text_date" value="{{ $forms.upd_f }}" /> ～ 
								<input type="text" name="upd_t" class="text_date" value="{{ $forms.upd_t }}" />
							</td>
						</tr>

					</tbody>
				</table>
				<p class="button" style="text-align:right">
					<button type="button" id="btn-reset"><span>クリア</span></button>
					<button type="button" id="btn_search" class="submit"><span>絞込検索</span></button>
				</p>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
				<input type="hidden" name="mapoperflg" />
			
			<hr>


{{ if is_numeric($page.cnt) }}
{{ if $page.cnt > 0 }}
			<p class="message">{{ $page.cnt }}件の情報が見つかりました。</p>
			<p align="left">{{$pageing}}</p>
			<div style ="overFlow-x:auto;overflow-y:hidden;width:100%">
			<table id="search_result" class="sortable" style ="overFlow-x:auto;width:1500px">
				<thead>
					<tr>
						<th><h3>有効にする<br>日付</h3></th>
						<th><h3>週名</h3></th>
						<th><h3>区分</h3></th>
						<th><h3>マップNO</h3></th>
						<th><h3>新聞紙名</h3></th>
						<th><h3>店コード</h3></th>
						<th><h3>店名</h3></th>
						<th><h3>合同マップ</h3></th>
						<th><h3>合同折込</h3></th>
						<th><h3>グループ<br>No</h3></th>
						<th><h3>折込負担<br>比率</h3></th>
						<th><h3>ダミー</h3></th>
						<th><h3>サービス</h3></th>
						<th><h3>コメント</h3></th>
						<th><h3>備考</h3></th>
						<th><h3>更新日時</h3></th>
					</tr>
				</thead>
				<tbody>
{{ foreach from=$data key=k item=v name="member" }}
					<tr class="{{cycle values=odd,mod name='member'}}">
					{{ if  $v.rowspan==1 }}	
						<td rowspan={{ $v.rowspannums }} class="{{ $v.rowspanclass }} center" >{{ $v.flier_date }}</td>
						<td rowspan={{ $v.rowspannums }} class="{{ $v.rowspanclass }} center" >{{ $v.week_cd }}</td>
					{{ /if }}
						<td>{{ $map_sort[$v.sort] }}</td>
						<td>{{ $v.map_no }}</td>
						<td>{{ $v.media_name }}</td>
						<td>{{ $v.shop_cd }}</td>
						<td>{{ $v.shop_name }}</td>
						<td>{{ $v.congruent_map }}</td>
						<td>{{ $v.congruent_ins }}</td>
						<td>{{ $v.group_no }}</td>
						<td>{{ $v.ins_load_ratio }}</td>
						<td>{{ $v.dummy }}</td>
						<td>{{ $v.service }}</td>
						<td>{{ $v.comm }}</td>
						<td>{{ $v.memo }}</td>
						<td class="center">{{ $v.u_time|date_format:"%Y-%m-%d %H:%M" }}</td>
					</tr>
{{ /foreach }}
				</tbody>
			</table>
			<br>
			</div>
			<!-- 		<td class="center"><input type="checkbox" name="delmapno[]" class="text" value="{{ $v.map_no }}" /> </td> -->
			<p align="right">{{$pageing}}</p>
				<p class="button">
					<button type="button" id="btn-export"  ><span>CSVダウンロード</span></button>
				</p>
{{ else }}
<p class="message">条件にマッチする情報は見つかりませんでした。</p>
{{ /if }}
{{ else }}
	<p class="message">ここに検索結果が表示されます。</p>
{{ /if }}
	</form>
<div id="dialog" >
</div>
		</div></div>
		{{ $footer }}
	</body>
</html>